package jhub.text;

import java.text.MessageFormat;
import java.text.ParseException;

import jhub.DCProtocol;

public class HubNameMessage  extends DCRawCommand{
    
    public static HubNameMessage getInstance(String hubName) throws ParseException{
        return new HubNameMessage(MessageFormat.format(DCProtocol.HUB_NAME_FORMAT,hubName));
    }
    
    private String hubName;
    
    private HubNameMessage(String command) throws ParseException {
        super(command);
        parse();
    }
    
    private void parse() throws ParseException{
        Object[] o = new MessageFormat(DCProtocol.HUB_NAME_FORMAT).parse(command.toString());
        this.hubName =o[0].toString();
    }

    public String getHubName() {
        return hubName;
    }
    
}
